package ch3;

public class Calculator {
	public int calcAvg(int a, int b) {
		if (a < 60)
			a = 60;

		System.out.println("现在开始计算：语文：" + a + ",数学：" + b);
		return (a + b) / 2;
	}

	public int calcAvg2(Student s) {
		if (s.name.equals("许鹏"))
			s.ch = 100;

		return (s.ch + s.math) / 2;
	}

	// 求多个学生的平均分
	public int calcAvg3(Student[] s) {
		int total = 0;
		for (int i = 0; i < s.length; i++) {
			total += s[i].ch + s[i].math;
		}
		return total / s.length;
	}
}
